project(KernelUDP)

# 设置策略CMP0091为NEW，新策略 用于MT/MD等编译选项的配置
if(POLICY CMP0091)
    cmake_policy(SET CMP0091 NEW)
endif(POLICY CMP0091)

include_directories(.)
include_directories(..)

# 源文件列表
set(SRC_LIST
        kernel.cpp
        Base/Kithara.cpp
)

# 头文件列表
set(HEAD_LIST
        Base/SharedData.h
)

# 生成可执行文件
add_library(${PROJECT_NAME}  SHARED
        ${SRC_LIST}
        ${HEAD_LIST}
)

# 配置生成库头文件路径
target_include_directories(${PROJECT_NAME}
        PUBLIC ${KITHARA_INCLUDE_SMP}
        PUBLIC ${KITHARA_INCLUDE}
)

# 链接依赖库
if(WIN32)
    target_link_libraries(${PROJECT_NAME} PUBLIC
            ${KITHARA_LIB}
    )
endif()

# 设置MT/MTd
set_property(TARGET ${PROJECT_NAME} PROPERTY
        MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# 设置编译选项
if (MSVC)
    set_target_properties(${PROJECT_NAME} PROPERTIES
            COMPILE_FLAGS "/EHsc"
    )
endif ()